﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ADA.Business;
using ADA.Entity;
using System.IO;

namespace ADA.Presentation.PRL.MarketNews
{
    public partial class ShowRiceForm : Form
    {
        int riceID;
        MainForm main;
        public ShowRiceForm(MainForm Main, int RiceID)
        {
            riceID = RiceID;
            main = Main;
            InitializeComponent();
        }

        private void ShowRiceForm_Load(object sender, EventArgs e)
        {
            string message;
            Rice rice;
            BOLNews bolNews = new BOLNews();
            if(bolNews.getRiceInfo(riceID, out rice, out message)==true)
            {
                lblTypeName.Text = rice.Name.ToString().Trim();
                lblTypeNameJP.Text = rice.NameJP.ToString().Trim();

                img.ImageLocation = Common.URL_RICE + Path.GetFileName(rice.Image.ToString().Trim());
                lblOrigin.Text = rice.Origin.ToString().Trim();
                lblOriginJP.Text = rice.OriginJP.ToString().Trim();
                tbxDescription.Text = rice.Description.ToString().Trim();
                tbxDescriptionJP.Text = rice.DescriptionJP.ToString().Trim();
            }
            else
            {
                MessageBox.Show(message);
            }
        }

        private void btnEdit_Click(object sender, EventArgs e)
        {
            this.Hide();
            main.btnEditRice_Click(sender, e);
            this.Close();
        }

        private void btnDelete_Click(object sender, EventArgs e)
        {
            main.btnDeleteRice_Click(sender, e);
            this.Close();
        }

        private void label5_Click(object sender, EventArgs e)
        {

        }

        private void label6_Click(object sender, EventArgs e)
        {

        }
    }
}
